package cn.source.system.utils;

import java.util.*;

public class SqlParamMapUtil {

    static Map<String, String> map = new HashMap<>();

    static {
        map.put("a", "--add-drop-table#--skip-add-drop-table");
        map.put("b", "--complete-insert#");
        map.put("c", "--disable-keys#--skip-disable-keys");
        map.put("d", "--create-options#--skip-create-options");
        map.put("e", "--lock-tables#--skip-lock-tables");
        map.put("f", "--routines#");
        map.put("g", "--add-drop-trigger#");
        map.put("h", "--add-locks#--skip-add-locks");
        map.put("i", "--no-data#");
        map.put("j", "--delayed-insert#");
        map.put("k", "--no-tablespaces#");
        map.put("l", "--extended-insert#--skip-extended-insert");
        map.put("m", "--no-create-info#");
        map.put("n", "--quick#");
    }


    public static String getParam(String[] param) {
        StringBuffer buffer = new StringBuffer();
        List<String> paramList = Arrays.asList(param);
        for (String s : map.keySet()) {
            String[] split = map.get(s).split("#");
            if (paramList.contains(s)) {
                buffer.append(split[0]).append(" ");
            } else {
                String val=split.length==1?"":split[1];
                buffer.append(val).append(" ");
            }
        }
        return buffer.toString();
    }
}
